package leetcode.editor.cn.q2xx

class Q263 {
    fun isUgly(n: Int): Boolean {
        if (n<=0) return false
        var rem = n
        while (rem % 5 == 0) {
            rem /= 5
        }
        while (rem % 3 == 0) {
            rem /= 3
        }
        while (rem % 2 == 0) {
            rem /= 2
        }
        return rem == 1
    }
}